<template>
    <div>
        <el-button type="success" @click="goHome1">首页1</el-button>
        <el-button type="success" @click="goHome2">首页2</el-button>
        <p>{{msg}}</p>
        <p>{{a}}</p>
        <p v-for="(item,index) in list4" :key="index">{{item.txt}}</p>
        <el-button type="primary" @click="changeItem">change</el-button>
        <el-button type="primary" @click="getNet">请求</el-button>
        <MyCom></MyCom>
    </div>
</template>
<script setup lang="ts">
import * as math from 'mathjs';
import { ref, reactive,getCurrentInstance } from 'vue';
import { useRouter,useRoute} from 'vue-router';
import { homeDate } from '@/api/home';

const { proxy } = getCurrentInstance();
console.log('zheli1');
console.log(proxy);
console.log(proxy.$wq);

const getData2 = async ()=>{
    proxy.$axios.post('/member/messageAndUserInfo/queryMessagePageList',{b:2}).then((res: any)=>{
        console.log('res----');
        console.log(res);
    }).catch();
};
//getData2();
const getData = async ()=>{
    let params = {
        a:1
    };
    await homeDate(params);
};
getData();

const getNet = ()=>{
    getData();
};

const msg = ref('ss');
const list = [{txt:'t1'},{txt:'t2'},{txt:'t3'}];
let list2 = reactive([{txt:'t1'},{txt:'t2'}]);
let t1 = ref('wnm');
let list3 = reactive([]);
let list4 = ref([{txt:'t1'},{txt:'t2'}]);


let a = 'wccc';

let n1 = math.add(0.2,0.4);
//console.log(n1);
const changeItem = ()=>{
    console.log('12');
    //list2.push({txt:'t4'});
    console.log(t1);
    let arr = [{txt:'t4'}];
    //list3.values = arr;
    list4.value.push({txt:'t4'});
    list4.value[1].txt = 't4444';
};
const router = useRouter();
const route  = useRoute();
const goHome1 = ()=>{
    //console.log(router);
    //console.log(route);
    //this.$route.push();
    router.push({
        name:'index'
    });
};
const goHome2 = ()=>{
    //console.log(router);
    //console.log(route);
    //this.$route.push();
    router.push({
        name:'index2',
        query:{
            a:2,
            b:23
        }
    });
};



</script>